<!-- <template>
<div>
    <Result type="success" title="标题" desc="结果描述" extra="其他补充信息，自带灰底效果">
        <template #actions>操作建议，一般放置按钮组</template>
    </Result>
    <Button type="success">返回首页</Button>
</div>  
</template>

<script>
import axios from 'axios'
export default {
data(){
return{
    params:{},

}
    },
created(){
    this.params = this.$route.params
    this.payMoney()
},
methods:{
    payMoney(){
        axios
          .post(
            "http://localhost:8081/salvage/products/buyProduct",
            {
                productId: this.$route.params.productId,
                studentId: this.$route.params.studentId,
                buyStatus:'1'
            }
          )
    }
}
}
</script>

<style>

</style> -->


<template>
    <div class="order-page">
      <div class="order-info">
        <h2 class="order-title">订单详情</h2>
        <div class="order-row">
          <span class="order-label">订单号:</span>
          <span class="order-value">00000{{item.orderId}}</span>
        </div>
        <div class="order-row">
          <span class="order-label">购买人:</span>
          <span class="order-value">{{items.name }}</span>
        </div>
        <div class="order-row">
          <span class="order-label">购买物品:</span>
          <span class="order-value">{{ item.prodName }}</span>
        </div>
        <div class="order-row">
          <span class="order-label">购买时间:</span>
          <span class="order-value">{{ item.createDate }}</span>
        </div>
        <div class="order-row">
          <span class="order-label">价格:</span>
          <span class="order-value">{{ item.price }}</span>
        </div>
      </div>
      <Button style="margin-top: 20px;" type="success" @click="goback()">返回首页</Button>
    </div>
  </template>
  
  <script>
  import axios from 'axios'
export default {
data(){
return{
    params:{},
    item:{},
    items:{}
}
    },
created(){
    this.params = this.$route.params
    this.payMoney()
},
methods:{
    payMoney(){
        axios
          .post(
            "http://localhost:8081/salvage/products/buyProduct",
            {
                productId: this.$route.params.productId,
                studentId: this.$route.params.studentId,
                buyStatus:'1'
            }
          ).then((res)=>{
            console.log(res.data.data);
            this.item = res.data.data
        
        this.showName(this.$route.params.studentId)
          })
    },
    showName(id){
        axios
          .post(
            "http://localhost:8081/salvage/students/getStudentAndProdById",
            {
                studentId: id,
            }
          ).then((res)=>{
            console.log(res.data.data);
            this.items =res.data.data
          })
    },
    goback(){
        this.$router.push({
            name:'theHome'
        })
    }
}
}
  </script>
  
  <style scoped>
  .order-page {
    width: 500px;
    margin: auto;
    font-family: Arial, sans-serif;
    margin-top: 100px;
  }
  
  .order-info {
    background-color: #F6F8FA;
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1);
  }
  
  .order-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
  }
  
  .order-label {
    font-weight: bold;
    margin-right: 10px;
  }
  
  .order-value {
    color: #666;
  }
  </style>
  